package com.thread.threadpool;

import java.util.concurrent.*;

public class ThreadPoolTest {

	static ExecutorService executorService = Executors.newSingleThreadExecutor();
	static ExecutorService executorService1 = new ThreadPoolExecutor(5,10, 0L, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(5));

	public static void main(String[] args) {

		Future<?> submit = executorService1.submit(new Work());
		try {
			System.out.println(submit.get());
		} catch (InterruptedException e) {
			e.printStackTrace();
		} catch (ExecutionException e) {
			e.printStackTrace();
		}
	}

	static class Work implements Callable {
		@Override
		public String call() {
			return "hello world";
		}
	}
}
